<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>

    <transition name="demo1">
      <h1 v-show="isShow">你好啊</h1>
    </transition>

    <transition name="demo2">
      <h1 v-show="isShow">你好啊</h1>
    </transition>
    
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  h1 {
    background-image: linear-gradient(45deg,red,yellow,green);
  }
  @keyframes dongqilai {
    0%{
      transform: translateX(0px);
    }
    100%{
      transform: translateX(-100%);
    }
  }
  .demo1-leave-active {
    animation: dongqilai 4s linear;
  }
  .demo1-enter-active {
    animation: dongqilai 4s linear reverse;
  } 
  .demo2-leave-active {
    animation: dongqilai 1s linear;
  }
  .demo2-enter-active {
    animation: dongqilai 1s linear reverse;
  } 
</style>